package com.mew.chess.core.game.lh.game;

import java.util.HashMap;
import java.util.Map;


public class LhGameManager {

    private int gameId;
    private static LhGameManager lhGameManager = new LhGameManager();
    private final Map<Integer, LhRoomManager> controllerMap = new HashMap<>(8);

    private LhGameManager(){
    }

    public static LhGameManager getInstance() {
        if (lhGameManager == null) {
            synchronized (LhGameManager.class) {
                if (lhGameManager == null) {
                    lhGameManager = new LhGameManager();
                }
            }
        }
        return lhGameManager;
    }


    public void putController(LhRoomManager controller){
        controllerMap.put(controller.getRoomId(), controller);
    }

    public LhRoomManager getController(Integer roomId){
        return controllerMap.get(roomId);
    }

    public int getGameId() {
        return gameId;
    }

    public void setGameId(int gameId) {
        this.gameId = gameId;
    }
}
